<?php

namespace app\service;

use app\model\Menu;

class MenuService
{
    private $menu;
    //创建构造方法
    public function __construct()
    {
        $this->menu = new Menu;
    }

    public function list($params=[])
    {
        $result = $this->menu->where(['status'=>1])->select();
        if(!empty($result)){
            $result = list_to_tree($result->toArray());
        }
        return $result;
    }
}
